// 多重背包
int n, m;
int f[maxn][max_size]; // 考虑前 i 个物品，选择总体积为 j 的最大总价值
// f[i][j] = max(f[i−1][j], f[i−1][j−wi] + vi)
int main() {
    int siz = 0;
    for (int i = 1; i <= n; i++) {
        int weight, value, k;
        cin >> weight >> value >> k;
        for (int base = 1; k > base; k -= base, base *= 2) { 
            w[++siz] = base * weight;
            v[siz] = base * value;
        } // k != base 是为了保证正好打包时，也执行补差
        w[++siz] = k * weight; // 补差
        v[siz] = k * value;
    }
    n = siz; // 更新
}